package com.mall.common.hessian.factory;

import com.caucho.hessian.io.*;

import java.math.BigDecimal;

public class BigDecimalSerializerFactory extends SerializerFactory {
    private StringValueSerializer bigDecimalSerializer = new StringValueSerializer();
    private BigDecimalDeserializer bigDecimalDeserializer = new BigDecimalDeserializer();

    @SuppressWarnings("rawtypes")
	@Override
    public Serializer getSerializer(Class cl) throws HessianProtocolException {
        if (BigDecimal.class.isAssignableFrom(cl)) {
            return bigDecimalSerializer;
        }
        return super.getSerializer(cl);
    }

    @SuppressWarnings("rawtypes")
	@Override
    public Deserializer getDeserializer(Class cl) throws HessianProtocolException {
        if (BigDecimal.class.isAssignableFrom(cl)) {
            return bigDecimalDeserializer;
        }
        return super.getDeserializer(cl);
    }
}
